package com.jimmy.gulei;

import java.util.ArrayList;
import java.util.List;

import android.content.ContentResolver;
import android.content.Context;
import android.database.Cursor;

public class DataBaseHandler {

	public Context mContext;
	ContentResolver mResolver;

	public DataBaseHandler(Context context) {
		if (null != context) {
			this.mContext = context;
			mResolver = this.mContext.getContentResolver();
		}

	}

	public List<RecomandArticles> getAllArticles() {
		List<RecomandArticles> list = new ArrayList<RecomandArticles>();
		;
		if (null != mResolver) {
			Cursor curso = mResolver.query(AllProvider.ARTICLE_URI,
					AllProvider.projection, null, null, null);
			while (curso.moveToNext()) {
				RecomandArticles article = new RecomandArticles();
				article.id = curso.getInt(0);
				article.title = curso.getString(1);
				article.labels = curso.getString(2);
				list.add(article);
			}
		}

		return list;

	}
}
